#ifndef APPLICATIONS_JSONRPC_ICORE_H_
#define APPLICATIONS_JSONRPC_ICORE_H_

#include <jsonrpc/icore4interface.h>
#include "threadunit/TestSram.h"
#include "threadunit/ModbusSystem.h"

class TestSram;
class ModbusSystem;

class Icore : public Icore4Interface
{
public:
    static Icore &getInstance();
    TestSram *sram;
    ModbusSystem *modbusSystem;

private:
    explicit Icore();                         // 构造函数私有化，禁止外部构造（Constructor privatization, prohibiting external constructions）
    Icore(Icore &) = delete;                  // 禁止拷贝构造（Prohibit copy construction）
    Icore &operator=(const Icore &) = delete; // 禁止赋值构造（Prohibit assignment construction）
    ~Icore();

    friend class TestSram;
    int testSram(int num, int *result) override;
    int printCmd(int num, int *result) override;
    int printParam(int addr, int data, int *result) override;
    int printReset(int num) override;

private:
    static Icore instance; // 单例模式（Single case mode）
};

#endif /* APPLICATIONS_JSONRPC_ICORE_H_ */
